Answer:

On my home computer, a 90 MHz Pentium, after one second the largest number was 2830. If you computer is faster, you should see a larger number.

A more recent run, on my more recent 2.0 GHz computer reached 90063 after one second.

Debugger

With loops, even a small program will execute thousands of statements in a few seconds. This makes it hard to figure out what is going on, sometimes. Pausing a program (by hitting the PAUSE key) is useful, but you have to be fast to see just a few statements execute.

In QBasic you can execute just one statement at a time by hitting the F8 key. Say you have the previous program:

' Counting up
LET COUNT = 0            'Statement 1

DO                       'Statement 2
  PRINT COUNT            'Statement 3
  LET COUNT = COUNT + 1  'Statement 4
LOOP                     'Statement 5

END

Do the following to execute statements one at a time:

  1. Select the Run menu typing "Alt-R".
  2. Type "R" for "Restart".
  3. The first statement of the program, LET COUNT = 0, will be highlighted.
  4. Now hit F8 just once. The first statement will execute, the program will pause, and the second statement (DO) will be highlighted.
  5. Hit F8 again, the highlighted statement (the second statement) will execute, the program will pause, and the highlight will move on to Statement 3.
  6. Hit F8 again and Statement 3 will execute and the highlight will move on to Statement 4.
  7. Anytime you want, you can hit F4 to see the program's output. If you that now, you will see the "0" that the PRINT just printed.
  8. Keep hitting F8. Each time one more statement will execute.

These are bothersome details. But they sometimes are very useful, so don't forget about them. (It is a really good idea to type in the program and do these steps. Just reading about it doesn't have the same impact as seeing the program running.)

QUESTION 13:

Say that Statement 5, LOOP, is highlighted. When you push F8:

What statement will be highlighted at this time?